<?php
class Zend_View_Helper_OrderedList
{
	private $i = 0;
	
	public function orderedList($list, $field, $space = "", $parentId = 0) 
	{
		foreach($list as $item) {
			if($item['parent_id'] == $parentId) {
				if($item['active'] == 1) {
					$approveImg = "icon_approve.jpg";
					$approveMsg = "Trạng thái hiện";
				} else {
					$approveImg = "icon_approve_off.jpg";
					$approveMsg = "Trạng thái ẩn";
				}
				?>
						<tr>
							<td class="ctn center"><?php echo ++$this->i;?></td>
							<td class="ctn"><?php echo $space;?><a href="#"><strong><?php echo $item[$field[1]]?></strong></a></td>
							<td class="ctn"><a href="#"><?php echo $item[$field[2]];?></a></td>
							<td class="ctn center"><input type="text" name="order_<?php echo $item[$field[0]];?>" value="<?php echo $item['ordering'];?>" size="5" /></td>
							<td class="ctn">
								<a class="action edit" rel="<?php echo $item[$field[0]];?>" title="Sửa" href="#"><img src="/intourv2/public/admin/images/icon_edit.jpg" alt="Sửa" /></a>
								<a class="action approve" rel="<?php echo $item[$field[0]];?>" href="#" id="<?php echo $item['active'];?>"><img src="/intourv2/public/admin/images/<?php echo $approveImg;?>" alt="<?php echo $approveMsg;?>" title="<?php echo $approveMsg;?>" /></a>
								<a class="action delete" rel="<?php echo $item[$field[0]];?>" title="Xóa" href="#"><img src="/intourv2/public/admin/images/icon_del.jpg" alt="Xóa" /></a>
							</td>
						</tr>
				<?php
				$this->orderedList($list, $field, $space."&nbsp;&nbsp;&nbsp;&nbsp;", $item[$field[0]]);
			}
		}
	}
} 